import fs from 'fs';

// 导出考勤记录数据，进行备份
export function exportAttendanceJson(config: {
  workDateFrom: string;
  workDateTo: string;
  results: any;
}) {
  const { workDateFrom, workDateTo, results = [] } = config;
  const filename = `data/attendance/${workDateFrom
    .split(' ')
    .at(0)}-${workDateTo.split(' ').at(0)}.json`;

  fs.writeFileSync(filename, JSON.stringify(results));
}
